package com.boco.pciv.service.project.impl;

import com.boco.pciv.core.service.PcivBaseServiceImpl;
//import com.boco.pciv.entity.project.FreeHouseInfo;
import com.boco.pciv.entity.project.ProjectInfo;
import com.boco.pciv.entity.project.User;
import com.boco.pciv.mapper.project.*;
import com.boco.pciv.service.project.IProjectCheckService;
import com.boco.pciv.service.project.IRecordService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service
public class ProjectCheckServiceImpl extends PcivBaseServiceImpl<IProjectCheckMapper,ProjectInfo,Integer> implements IProjectCheckService {
    //logger
    private static final Logger _logger = LoggerFactory.getLogger(ProjectCheckServiceImpl.class);

//    @Autowired
//    private IFreeCheckMapper iFreeMapper;
//    @Autowired
//    private IPropertyCheckMapper iPropertyMapper;
//    @Autowired
//    private IFreeHouseCheckMapper iFreeHouseMapper;
    @Autowired
    private IRecordService iRecordService;


    public ProjectInfo getProject(String projectId) {
       Map<String, Object> map = new HashMap();
        map.put("projectId", projectId);
       ProjectInfo info = mapper.queryOneByMap(map);
        return info;
    }


    public void addProject(ProjectInfo info) {
        //deleteProjectChild(info.getProjectid());
        //addProjectChild(info);
        mapper.insert(info);
//        iRecordService.projectRecord(info, 1, info.getCreateUser());
    }

    public void editProject(ProjectInfo info) {
        mapper.update(info);
    }

    public void insertRecord(ProjectInfo info) {
        mapper.insertCheckRecord(info);
    }

    public void deleteProject(String projectId) {
        Map<String, Object> map = new HashMap();
        map.put("projectId",projectId);
        mapper.deleteCheckProject(map);
    }

    public int CheckProject(ProjectInfo info) {
        Map<String, Object> map = new HashMap();
        map.put("projectName", info.getProjectname());
        map.put("licno", info.getLicno());
       return mapper.queryList(map).size();
    }

    public List<ProjectInfo> getSelectByProjecttype() {
        List<ProjectInfo> list=  mapper.getCheckSelectByProjecttype();
        return list;
    }

    public List<ProjectInfo> getSelectByProjectstatus() {
        List<ProjectInfo> list=  mapper.getCheckSelectByProjectstatus();
        return list;
    }

    public User getDept(User info) {
        User value=  mapper.getCheckDept(info);
        return value;
    }
}
